export default function({ Button }) {
	let level = 1;
	const area = this.area({
		[env === 'react-antd' ? 'title' : 'header']: '无限弹框示例'
	});
	const config = (show) => ({
		title: `当前层级【第${level++}层】`,
		children: [
			this.render({
				is: Button,
				children: '新弹出一层',
				onClick: () => this.dialog(config)
			}),
			this.render({
				is: Button,
				children: '关闭当前层',
				onClick: () => show.value = false
			}),
			this.render({
				is: Button,
				children: '关闭最上层',
				onClick: () => this.dialog().close()
			}),
			this.render({
				is: Button,
				children: '关闭所有层',
				onClick: () => {
					level = 1;
					this.dialog().closeAll();
				},
			})
		]
	});
	area.add(
		this.render({
			is: Button,
			type: 'primary',
			children: '开启无限弹框',
			onClick: () => this.dialog(config),
		}),
	).done();
}